$(function() {
	load_asset_select();
	load_asset_cond_select();
	
	_addChangeListener("#asset_select", function() {
		var option = $('#asset_select option:selected');
		if(view && view.data) {view.data.assetName = option.text();}
	});
});

function load_asset_select() {
	if($('#asset_select').length==0) {return;}

	$('#asset_select').html('<option value="" selected></option>');

	findAll_basic(path+'/asset/findAll', function(response) {
		for(var i=0; i<response.data.length; i++) {
			$('#asset_select').append('<option value="' + response.data[i].assetId
				+ '">' + response.data[i].assetName + '</option>');
		}
	});
}

function load_asset_cond_select() {
	if($('#asset_cond_select').length==0) {return;}

	$('#asset_cond_select').html('<option value="" selected></option>');

	findAll_basic(path+'/asset/findAll', function(response) {
		for(var i=0; i<response.data.length; i++) {
			$('#asset_cond_select').append('<option value="' + response.data[i].assetId
				+ '">' + response.data[i].assetName + '</option>');
		}
	});
}
